package com.hpeu_12.day1231;

public class Employee {
	private String name;
	private int age;
	public Employee(String name, int age) {
		super();
		this.name = name;
		this.age = age;
	}
	public Employee() {
		
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + age;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	
	//写equals()方法
	
	public boolean equals(Object obj) {
		if (obj == null) return false;
		if (obj instanceof Employee) {
			Employee e = (Employee)obj;
			if (this.name.equals(e.name)) {
				if (this.age == e.age) {
					return true;
				}else {
					return false;
				}
			}else {
				return false;
			}
		}
		return false;
	}
	
}
